import Vue from 'vue'
import Vuex from 'vuex'
import menus from "./modules/menus"
import userinfo from "./modules/userinfo"

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: ''
  },
  getters: {
  },
  mutations: {
    SET_TOKEN: (state, token) => {
      state.token = token
      localStorage.setItem("token", token)
    },
    ["testStore"](state, val) {
      console.log(val);
    }
  },
  actions: {
    // 使用["xxx"]作为方法名称
    ["testStore"](state, val) {
      state.commit("testStore", val);
    }
  },
  modules: {
    menus, userinfo
  }
})
